# (C) Datadog, Inc. 2023-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.base.stubs.aggregator import AggregatorStub

TAGS = ["endpoint:http://localhost:8000/metrics"]

# A representative sampling of metrics from the fixture used for unit tests
METRICS = [
    {
        "name": "ack_level.update.count",
        "value": 12,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:TimerQueueProcessor", "service_name:history"],
    },
    {
        "name": "ack_level.update.count",
        "value": 12,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:TransferQueueProcessor", "service_name:history"],
    },
    {
        "name": "ack_level.update.count",
        "value": 12,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:VisibilityQueueProcessor", "service_name:history"],
    },
    {
        "name": "acquire_shards.count",
        "value": 2,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history"],
    },
    {
        "name": "acquire_shards.latency.bucket",
        "value": 1,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history", "upper_bound:0.001"],
    },
    {
        "name": "acquire_shards.latency.bucket",
        "value": 1,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history", "upper_bound:0.005"],
    },
    {
        "name": "acquire_shards.latency.bucket",
        "value": 2,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history", "upper_bound:0.1"],
    },
    {
        "name": "acquire_shards.latency.bucket",
        "value": 2,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history", "upper_bound:1000.0"],
    },
    {
        "name": "acquire_shards.latency.count",
        "value": 2,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history"],
    },
    {
        "name": "acquire_shards.latency.sum",
        "value": 0.066191125,
        "type": AggregatorStub.MONOTONIC_COUNT,
        "tags": TAGS + ["operation:ShardController", "service_name:history"],
    },
    {
        "name": "loaded_task_queue_count",
        "value": 4,
        "type": AggregatorStub.GAUGE,
        "tags": TAGS
        + [
            "namespace:default",
            "operation:MatchingEngine",
            "queue_type:Normal",
            "service_name:matching",
            "task_type:Activity",
        ],
    },
    {
        "name": "loaded_task_queue_count",
        "value": 2,
        "type": AggregatorStub.GAUGE,
        "tags": TAGS
        + [
            "namespace:default",
            "operation:MatchingEngine",
            "queue_type:Sticky",
            "service_name:matching",
            "task_type:Workflow",
        ],
    },
]

MOCKED_METRICS = [
    "temporal.server.action.count",
    "temporal.server.activity.end_to_end_latency.bucket",
    "temporal.server.activity.end_to_end_latency.count",
    "temporal.server.activity.end_to_end_latency.sum",
    "temporal.server.activity_info.bucket",
    "temporal.server.activity_info.count",
    "temporal.server.activity_info.size.bucket",
    "temporal.server.activity_info.size.count",
    "temporal.server.activity_info.size.sum",
    "temporal.server.activity_info.sum",
    "temporal.server.add_search_attributes.workflow_failure",
    "temporal.server.add_search_attributes.workflow_failure.count",
    "temporal.server.add_search_attributes.workflow_success.count",
    "temporal.server.buffered_events.bucket",
    "temporal.server.buffered_events.count",
    "temporal.server.buffered_events.size.bucket",
    "temporal.server.buffered_events.size.count",
    "temporal.server.buffered_events.size.sum",
    "temporal.server.buffered_events.sum",
    "temporal.server.cache.latency.bucket",
    "temporal.server.cache.latency.count",
    "temporal.server.cache.latency.sum",
    "temporal.server.cache.miss.count",
    "temporal.server.cache.requests.count",
    "temporal.server.certificates.expired",
    "temporal.server.certificates.expiring",
    "temporal.server.child_info.bucket",
    "temporal.server.child_info.count",
    "temporal.server.child_info.size.bucket",
    "temporal.server.child_info.size.count",
    "temporal.server.child_info.size.sum",
    "temporal.server.child_info.sum",
    "temporal.server.client.errors.count",
    "temporal.server.client.latency.bucket",
    "temporal.server.client.latency.count",
    "temporal.server.client.latency.sum",
    "temporal.server.client.redirection.errors.count",
    "temporal.server.client.redirection.latency.bucket",
    "temporal.server.client.redirection.latency.count",
    "temporal.server.client.redirection.latency.sum",
    "temporal.server.client.redirection.requests.count",
    "temporal.server.client.requests.count",
    "temporal.server.cluster_metadata.callback.lock_latency.bucket",
    "temporal.server.cluster_metadata.callback.lock_latency.count",
    "temporal.server.cluster_metadata.callback.lock_latency.sum",
    "temporal.server.cluster_metadata.lock_latency.bucket",
    "temporal.server.cluster_metadata.lock_latency.count",
    "temporal.server.cluster_metadata.lock_latency.sum",
    "temporal.server.complete_workflow_command.count",
    "temporal.server.complete_workflow_task_sticky.enabled.count",
    "temporal.server.elasticsearch.bulk_processor.bulk_size.bucket",
    "temporal.server.elasticsearch.bulk_processor.bulk_size.count",
    "temporal.server.elasticsearch.bulk_processor.bulk_size.sum",
    "temporal.server.elasticsearch.bulk_processor.commit.latency.bucket",
    "temporal.server.elasticsearch.bulk_processor.commit.latency.count",
    "temporal.server.elasticsearch.bulk_processor.commit.latency.sum",
    "temporal.server.elasticsearch.bulk_processor.queued_requests.bucket",
    "temporal.server.elasticsearch.bulk_processor.queued_requests.count",
    "temporal.server.elasticsearch.bulk_processor.queued_requests.sum",
    "temporal.server.elasticsearch.bulk_processor.request.latency.bucket",
    "temporal.server.elasticsearch.bulk_processor.request.latency.count",
    "temporal.server.elasticsearch.bulk_processor.request.latency.sum",
    "temporal.server.elasticsearch.bulk_processor.requests.count",
    "temporal.server.elasticsearch.bulk_processor.wait_add.latency.bucket",
    "temporal.server.elasticsearch.bulk_processor.wait_add.latency.count",
    "temporal.server.elasticsearch.bulk_processor.wait_add.latency.sum",
    "temporal.server.elasticsearch.bulk_processor.wait_start.latency.bucket",
    "temporal.server.elasticsearch.bulk_processor.wait_start.latency.count",
    "temporal.server.elasticsearch.bulk_processor.wait_start.latency.sum",
    "temporal.server.event.blob_size.bucket",
    "temporal.server.event.blob_size.count",
    "temporal.server.event.blob_size.sum",
    "temporal.server.execution_info.size.bucket",
    "temporal.server.execution_info.size.count",
    "temporal.server.execution_info.size.sum",
    "temporal.server.execution_state.size.bucket",
    "temporal.server.execution_state.size.count",
    "temporal.server.execution_state.size.sum",
    "temporal.server.forwarded.count",
    "temporal.server.forwarded_per_tl.count",
    "temporal.server.get_engine_for_shard.latency.bucket",
    "temporal.server.get_engine_for_shard.latency.count",
    "temporal.server.get_engine_for_shard.latency.sum",
    "temporal.server.history.bucket",
    "temporal.server.history.count",
    "temporal.server.history.event_notification.fanout_latency.bucket",
    "temporal.server.history.event_notification.fanout_latency.count",
    "temporal.server.history.event_notification.fanout_latency.sum",
    "temporal.server.history.event_notification.inflight_message",
    "temporal.server.history.event_notification.queueing_latency.bucket",
    "temporal.server.history.event_notification.queueing_latency.count",
    "temporal.server.history.event_notification.queueing_latency.sum",
    "temporal.server.history.size.bucket",
    "temporal.server.history.size.count",
    "temporal.server.history.size.sum",
    "temporal.server.history.sum",
    "temporal.server.lease.requests.count",
    "temporal.server.local_to_local.matches.count",
    "temporal.server.lock.failures.count",
    "temporal.server.lock.latency.bucket",
    "temporal.server.lock.latency.count",
    "temporal.server.lock.latency.sum",
    "temporal.server.lock.requests.count",
    "temporal.server.memo_size.bucket",
    "temporal.server.memo_size.count",
    "temporal.server.memo_size.sum",
    "temporal.server.mutable_state.size.bucket",
    "temporal.server.mutable_state.size.count",
    "temporal.server.mutable_state.size.sum",
    "temporal.server.namespace_cache.callbacks_latency.bucket",
    "temporal.server.namespace_cache.callbacks_latency.count",
    "temporal.server.namespace_cache.callbacks_latency.sum",
    "temporal.server.namespace_cache.prepare_callbacks_latency.bucket",
    "temporal.server.namespace_cache.prepare_callbacks_latency.count",
    "temporal.server.namespace_cache.prepare_callbacks_latency.sum",
    "temporal.server.namespace_registry.lock_latency.bucket",
    "temporal.server.namespace_registry.lock_latency.count",
    "temporal.server.namespace_registry.lock_latency.sum",
    "temporal.server.new_timer_notifications.count",
    "temporal.server.numshards",
    "temporal.server.pending_tasks.bucket",
    "temporal.server.pending_tasks.count",
    "temporal.server.pending_tasks.sum",
    "temporal.server.persistence.error_with_type.count",
    "temporal.server.persistence.latency.bucket",
    "temporal.server.persistence.latency.count",
    "temporal.server.persistence.latency.sum",
    "temporal.server.persistence.requests.count",
    "temporal.server.poll.success.count",
    "temporal.server.poll.success_sync.count",
    "temporal.server.poll.timeouts.count",
    "temporal.server.queue.latency_schedule.bucket",
    "temporal.server.queue.latency_schedule.count",
    "temporal.server.queue.latency_schedule.sum",
    "temporal.server.queue.reader.bucket",
    "temporal.server.queue.reader.count",
    "temporal.server.queue.reader.sum",
    "temporal.server.queue.slice.bucket",
    "temporal.server.queue.slice.count",
    "temporal.server.queue.slice.sum",
    "temporal.server.remote_to_local.matches.count",
    "temporal.server.remote_to_remote.matches.count",
    "temporal.server.replication.task_cleanup.count",
    "temporal.server.replication.tasks.lag.bucket",
    "temporal.server.replication.tasks.lag.count",
    "temporal.server.replication.tasks.lag.sum",
    "temporal.server.request_cancel_info.bucket",
    "temporal.server.request_cancel_info.count",
    "temporal.server.request_cancel_info.size.bucket",
    "temporal.server.request_cancel_info.size.count",
    "temporal.server.request_cancel_info.size.sum",
    "temporal.server.request_cancel_info.sum",
    "temporal.server.schedule_activity_command.count",
    "temporal.server.search_attributes_size.bucket",
    "temporal.server.search_attributes_size.count",
    "temporal.server.search_attributes_size.sum",
    "temporal.server.service.authorization_latency.bucket",
    "temporal.server.service.authorization_latency.count",
    "temporal.server.service.authorization_latency.sum",
    "temporal.server.service.error_with_type.count",
    "temporal.server.service.errors.count",
    "temporal.server.service.errors.critical.count",
    "temporal.server.service.errors.resource_exhausted.count",
    "temporal.server.service.latency.bucket",
    "temporal.server.service.latency.count",
    "temporal.server.service.latency.nouserlatency.bucket",
    "temporal.server.service.latency.nouserlatency.count",
    "temporal.server.service.latency.nouserlatency.sum",
    "temporal.server.service.latency.sum",
    "temporal.server.service.latency.userlatency.bucket",
    "temporal.server.service.latency.userlatency.count",
    "temporal.server.service.latency.userlatency.sum",
    "temporal.server.service.pending_requests",
    "temporal.server.service.requests.count",
    "temporal.server.shard.lock_latency.bucket",
    "temporal.server.shard.lock_latency.count",
    "temporal.server.shard.lock_latency.sum",
    "temporal.server.shard_controller.lock_latency.bucket",
    "temporal.server.shard_controller.lock_latency.count",
    "temporal.server.shard_controller.lock_latency.sum",
    "temporal.server.shardinfo.replication.lag.bucket",
    "temporal.server.shardinfo.replication.lag.count",
    "temporal.server.shardinfo.timer.lag.bucket",
    "temporal.server.shardinfo.timer.lag.count",
    "temporal.server.shardinfo.timer.lag.sum",
    "temporal.server.shardinfo.transfer.lag.bucket",
    "temporal.server.shardinfo.transfer.lag.count",
    "temporal.server.shardinfo.visibility.lag.bucket",
    "temporal.server.shardinfo.visibility.lag.count",
    "temporal.server.shardinfo.visibility.lag.sum",
    "temporal.server.sharditem.acquisition_latency.bucket",
    "temporal.server.sharditem.acquisition_latency.count",
    "temporal.server.sharditem.acquisition_latency.sum",
    "temporal.server.sharditem.created.count",
    "temporal.server.signal_info.bucket",
    "temporal.server.signal_info.count",
    "temporal.server.signal_info.size.bucket",
    "temporal.server.signal_info.size.count",
    "temporal.server.signal_info.size.sum",
    "temporal.server.signal_info.sum",
    "temporal.server.state_transition.bucket",
    "temporal.server.state_transition.count",
    "temporal.server.state_transition.sum",
    "temporal.server.syncmatch.latency.bucket",
    "temporal.server.syncmatch.latency.count",
    "temporal.server.syncmatch.latency.sum",
    "temporal.server.task.attempt.bucket",
    "temporal.server.task.attempt.count",
    "temporal.server.task.attempt.sum",
    "temporal.server.task.batch_complete_counter.count",
    "temporal.server.task.bucket",
    "temporal.server.task.count",
    "temporal.server.task.lag_per_tl",
    "temporal.server.task.latency.bucket",
    "temporal.server.task.latency.count",
    "temporal.server.task.latency.load.bucket",
    "temporal.server.task.latency.load.count",
    "temporal.server.task.latency.load.sum",
    "temporal.server.task.latency.processing.bucket",
    "temporal.server.task.latency.processing.count",
    "temporal.server.task.latency.processing.sum",
    "temporal.server.task.latency.queue.bucket",
    "temporal.server.task.latency.queue.count",
    "temporal.server.task.latency.queue.sum",
    "temporal.server.task.latency.schedule.bucket",
    "temporal.server.task.latency.schedule.count",
    "temporal.server.task.latency.schedule.sum",
    "temporal.server.task.latency.sum",
    "temporal.server.task.latency.user.bucket",
    "temporal.server.task.latency.user.count",
    "temporal.server.task.latency.user.sum",
    "temporal.server.task.requests.count",
    "temporal.server.task.schedule_to_start_latency.bucket",
    "temporal.server.task.schedule_to_start_latency.count",
    "temporal.server.task.schedule_to_start_latency.sum",
    "temporal.server.task.sum",
    "temporal.server.task_queue.started.count",
    "temporal.server.task_rescheduler.pending_tasks.bucket",
    "temporal.server.task_rescheduler.pending_tasks.count",
    "temporal.server.task_rescheduler.pending_tasks.sum",
    "temporal.server.timer_info.bucket",
    "temporal.server.timer_info.count",
    "temporal.server.timer_info.size.bucket",
    "temporal.server.timer_info.size.count",
    "temporal.server.timer_info.size.sum",
    "temporal.server.timer_info.sum",
    "temporal.server.version_check.failed.count",
    "temporal.server.version_check.latency.bucket",
    "temporal.server.version_check.latency.count",
    "temporal.server.version_check.latency.sum",
    "temporal.server.version_check.request_failed.count",
    "temporal.server.visibility.persistence.latency.bucket",
    "temporal.server.visibility.persistence.latency.count",
    "temporal.server.visibility.persistence.latency.sum",
    "temporal.server.visibility.persistence.requests.count",
    "temporal.server.wf_too_many_pending.activities.count",
    "temporal.server.wf_too_many_pending.cancel_requests.count",
    "temporal.server.wf_too_many_pending.child_workflows.count",
    "temporal.server.wf_too_many_pending.external_workflow_signals.count",
    "temporal.server.workflow.success.count",
    "temporal.server.workflow.task.attempt.bucket",
    "temporal.server.workflow.task.attempt.count",
    "temporal.server.workflow.task.attempt.sum",
    "temporal.server.workflow.task.timeout_overrides.count",
]
